#include <iostream>

void seed(unsigned int num) {
   srand(num);
}

int roll(int dice) {
   int i, die, result = 0;
   for(i = 0; i < dice; i += 1) {
      die = rand() % 6 + 1;
      if(die == 6 && result >= 6) {
         result += 1;
      }
      else if(die > result) {
         result = die;
      }
   }
   return result;
}